namespace Learnive.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Year : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Vaks", "JaarId", "dbo.Jaars");
            DropIndex("dbo.Vaks", new[] { "JaarId" });
            CreateTable(
                "dbo.Years",
                c => new
                    {
                        YearId = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                    })
                .PrimaryKey(t => t.YearId);
            
            CreateTable(
                "dbo.Lessons",
                c => new
                    {
                        LessonId = c.Int(nullable: false, identity: true),
                        YearId = c.Int(nullable: false),
                        Title = c.String(nullable: false, maxLength: 160),
                        Code = c.String(nullable: false, maxLength: 1024),
                        Description = c.String(maxLength: 1024),
                    })
                .PrimaryKey(t => t.LessonId)
                .ForeignKey("dbo.Years", t => t.YearId, cascadeDelete: true)
                .Index(t => t.YearId);
            
            DropTable("dbo.Vaks");
            DropTable("dbo.Jaars");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.Jaars",
                c => new
                    {
                        jaarId = c.Int(nullable: false, identity: true),
                        Naam = c.String(nullable: false, maxLength: 160),
                    })
                .PrimaryKey(t => t.jaarId);
            
            CreateTable(
                "dbo.Vaks",
                c => new
                    {
                        vakId = c.Int(nullable: false, identity: true),
                        JaarId = c.Int(nullable: false),
                        Naam = c.String(nullable: false, maxLength: 160),
                        Code = c.String(nullable: false, maxLength: 160),
                        Beschrijving = c.String(maxLength: 1024),
                    })
                .PrimaryKey(t => t.vakId);
            
            DropIndex("dbo.Lessons", new[] { "YearId" });
            DropForeignKey("dbo.Lessons", "YearId", "dbo.Years");
            DropTable("dbo.Lessons");
            DropTable("dbo.Years");
            CreateIndex("dbo.Vaks", "JaarId");
            AddForeignKey("dbo.Vaks", "JaarId", "dbo.Jaars", "jaarId", cascadeDelete: true);
        }
    }
}
